import 'package:flutter/material.dart';
import 'package:love_app/common/su.dart';
import 'package:love_app/common/su_dialog.dart';
import 'package:love_app/providers/share_provider.dart';
import 'package:provider/provider.dart';

class DiamondRecharge extends StatefulWidget {
  @override
  _DiamondRechargeState createState() => _DiamondRechargeState();
}

class _DiamondRechargeState extends State<DiamondRecharge> {
  ShareProvider _shareProvider;

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();
    _shareProvider = Provider.of<ShareProvider>(context, listen: false);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: Su().appBar(
        "充值钻石",
        colors: _shareProvider.themeColor,
      ),
      body: _body(),
    );
  }

  // 页面内容
  Widget _body() {
    return Container(
      width: Su().w(750),
      child: Column(
        children: <Widget>[
          _test(),
          _explain(),
        ],
      ),
    );
  }

  // 加载钻石充值页面， 后续删除
  Widget _test() {
    return InkWell(
      onTap: (){
        SuDialog.showToast("支付尚未开通");
      },
      child: Container(
        width: Su().w(750),
        child: Image.asset(
          "images/other/test.png",
        ),
      ),
    );
  }

  // 说明
  Widget _explain() {
    return Container(
      width: Su().w(750),
      // height: Su().h(279),
      color: Colors.white,
      child: Column(
        // crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          _explainText(),
          _explainPic(),
        ],
      ),
    );
  }

  // 说明文字
  Widget _explainText() {
    return Container(
      padding: EdgeInsets.only(
        top: Su().h(17),
      ),
      width: Su().w(684),
      // height: Su().h(65),
      child: Text(
        "钻石仅供自己使用，无法为另一半购买，可用于以下功能中购买 付费道具",
        style: Su().textStyle(Color.fromRGBO(38, 38, 38, 1), 24),
      ),
    );
  }

  // 图片说明
  Widget _explainPic() {
    return Container(
      padding: EdgeInsets.only(
        top: Su().h(25),
        bottom: Su().h(26),
      ),
      child: Row(
        children: <Widget>[
          _explainPicItem("images/mine_page/tree.png", "爱情树"),
          _explainPicItem("images/mine_page/dog.png", "我们的宠物"),
        ],
      ),
    );
  }

  // 每一个图片内容
  Widget _explainPicItem(String imagePath, String title) {
    return Container(
      padding: EdgeInsets.only(
        left: Su().w(73),
      ),
      child: Column(
        children: <Widget>[
          Image.asset(
            imagePath,
            width: Su().w(104),
            height: Su().w(104),
          ),
          Text(
            title,
            style: Su().textStyle(Color.fromRGBO(38, 38, 38, 1), 26),
          ),
        ],
      ),
    );
  }
}
